/** 存放花卉商城模块相关接口 */ 
import myaxios from "../MyAxios";
import URLENV from '@/http/BaseUrl';
const  HYRJURL=URLENV.HYRJURL
const mallApi={
    /** 删除演员 返回发送请求后的Promise对象 gid */
    delete(params){
      const url=HYRJURL+ '/mall/deleteDetail'
     return myaxios.get(url,params)
    },
     /**
   * 新增商品
   * @param {Object} params {sname:名称,pic:图片路径,price:价格}
   */
  addShow(params){
    return myaxios.post(HYRJURL+'/mall/flowerAdd',params)
  },
  queryByName(params){
    return myaxios.get(HYRJURL+'/mall/flowerSearch',params)
  },
  /**
   * 查询所有商品(分页)
   * @params {Object} params
   * {page:1,pagesize:5}
   */
  queryAll(params){
   // console.log(HYRJURL);
    return myaxios.get(HYRJURL+'/mall/flowerList',params)
    
  },
  /***
   * 通过gid查询商品详情
   * @params {Object} params 
   * {gid:1}
   */
  queryDetailByGid(params){
  //  console.log('gid...');
    return myaxios.get(HYRJURL+'/mall/searchDetailByGid',params)
  },
  // /mall/AddDetail
  /***
   * 模糊查询商品详情
   * @params {Object} params 
   * {dname:'百合'}
   */
  queryDetailLike(params){
    return myaxios.get(HYRJURL+'/mall/SearchDetailByName',params)
  },
  /***
   * 修改商品详情
   * @params {Object} params 
   * {gid:1}
   */
  updateDetail(params){
    return myaxios.post(HYRJURL+'/mall/updateDetail',params)
  },
  /***
   * 添加商品详情
   * @params {Object} params 
   */
  addDetail(params){
    return myaxios.post(HYRJURL+'/mall/AddDetail',params)
  },
  /***
   * 查询所有类别
   * @params {Object} params 
   */
  queryAllTypeId(params){
    return myaxios.get(HYRJURL+'/index',params)
  },
  /**
   * 新增订单
   * @param {Object} params {oname:名称,properties:商品属性,price:价格,num:数量}
   */
  addOrder(params){
    return myaxios.post(HYRJURL+'/mall/AddOrder',params)
  },
  /**
   * 查询所有订单(分页)
   * @params {Object} params
   * {page:1,pagesize:5}
   */
  queryOrderList(params){
   // console.log(HYRJURL);
    return myaxios.get(HYRJURL+'/mall/OrderList',params)
  },
   /***
   * 模糊查询订单
   * @params {Object} params 
   * {oname:'百合'}
   */
   queryOrderLike(params){
    return myaxios.get(HYRJURL+'/mall/orderListByOnameLike',params)
  },
  /** 删除oid对应的订单 返回发送请求后的Promise对象 */
  deleteOrder(params){
    const url=HYRJURL+ '/mall/DeleteOrder'
    return myaxios.get(url,params)
  },
  /***
   * 通过oid查询商品详情
   * @params {Object} params 
   * {oid:1}
   */
  queryOrderByOid(params){
  //  console.log('oid...');
    return myaxios.get(HYRJURL+'/mall/searchOrderByOid',params)
  },
  /***
   * 修改订单
   * @params {Object} params 
   * {oid:1}
   */
  updateOrder(params){
    return myaxios.post(HYRJURL+'/mall/UpdateOrder',params)
  },
  /**
   * 新增收获地址
   * @param {Object} params {receiver:收货人,locationAddress:收货地址,detailedAddress:详细地址,postalCode:邮编,phone:电话号码}
   */
  addDeliveryAddress(params){
    return myaxios.post(HYRJURL+'/mall/AddDeliveryAddress',params)
  },
  /**
   * 查询所有收货地址(分页)
   * @params {Object} params
   * {page:1,pagesize:5}
   */
  queryAllDeliveryAddress(params){
   // console.log(HYRJURL);
    return myaxios.get(HYRJURL+'/mall/SearchDeliveryAddressList',params)
  },
  /***
   * 模糊查询收货地址
   * @params {Object} params 
   * {receiver:'美'}
   */
  queryDeliveryAddressLike(params){
    return myaxios.get(HYRJURL+'/mall/deliveryAddressSearchLike',params)
  },
   /** 删除收货地址 返回发送请求后的Promise对象 id */
  deleteDeliveryAddress(params){
    const url=HYRJURL+ '/mall/DeleteDeliveryAddress'
   return myaxios.get(url,params)
  },
  /***
   * 通过id查询收货地址
   * @params {Object} params 
   * {id:1}
   */
  queryDeliveryAddressById(params){
  //  console.log('id...');
    return myaxios.get(HYRJURL+'/mall/searchDeliveryAddressById',params)
  },
  /***
   * 修改收货地址
   * @params {Object} params 
   * {id:1}
   */
  updateDeliveryAddress(params){
    return myaxios.post(HYRJURL+'/mall/UpdateDeliveryAddress',params)
  }
}
//src="https://www.codeboy.com/zhsqapi/img/ad/1516731234475.jpg"
export default mallApi;